Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-indent

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-indent

Detect the indentation of code

  • 5.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17M
increased by20.42%
Maintainers
1
Weekly downloads
 
Created

What is detect-indent?

The detect-indent npm package is designed to analyze a given piece of text and determine the indentation style used. This can be particularly useful in scenarios where maintaining consistent code formatting is crucial, such as in collaborative coding projects. It can detect both spaces and tabs used for indentation and provide information about the most used indentation type and size.

What are detect-indent's main functionalities?

Detecting indentation from a string

This feature allows you to pass a string of text to the `detectIndent` function, which analyzes the indentation used in the text. It returns an object containing the amount of indentation, the type of indentation (spaces or tabs), and the actual indentation string.

const detectIndent = require('detect-indent');
const code = '  const x = 1;\n  const y = 2;';
const indent = detectIndent(code);
console.log(indent); // {amount: 2, type: 'space', indent: '  '}

Other packages similar to detect-indent

Keywords

FAQs

Package last updated on 20 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc